package com.kfm.servlet;

import com.kfm.dao.StudentDao;
import com.kfm.model.Student;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.util.List;

@WebServlet("/student")
public class SelectStudentsServlet extends GenericServlet {
    private StudentDao studentDao = new StudentDao();

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        // TODO 查询所有学生
        try {
            List<Student> students = studentDao.selectAll();
            students.forEach(obj -> System.out.println(obj));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
